package approvalDao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: LYZ
 * \* Date: 2022/2/19
 * \* Time: 17:17
 * \* Description:
 * \
 */
public class ConnectionFactory {
    private static Connection conn=null;
    public static java.sql.Connection getConnection(){
        try {
            //加载驱动
            Class.forName("com.mysql.cj.jdbc.Driver");
            //获得链接
            String url = "jdbc:mysql://localhost:3306/assetmanagement? useUnicode = true&characterEocoding = utf8&useSSL=FALSE&serverTimezone=UTC&allowPublicKeyRetrieval=true";
            conn = DriverManager.getConnection(url, "root", "203025");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return conn;
    }




}
